package com.laputa.web.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.EventDispatchAction;

import com.laputa.service.method.ShowGroundService;
import com.laputa.service.model.ShowGroundData;

public class ShowGroundAction extends EventDispatchAction {
	ShowGroundService showGroundService;
	
	public void setShowGroundService(ShowGroundService showGroundService) {
		this.showGroundService = showGroundService;
	}
	
	public ActionForward show(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm toidentify = (DynaActionForm) form;
		String groundID = (String) toidentify.get("groundID");
		//request.setAttribute("groundID", groundID);
		
		System.out.println("from action: groundid = " + groundID);
		ShowGroundData data = showGroundService.getShowGroundData(groundID);
		request.setAttribute("showGroundData", data);
		
		return mapping.findForward("success");
	}
}
